package day8.homework;

//a.有三个线程A，B，C，每个线程只打印线程名
// 保证三个线程的执行顺序永远是 DemoA -->B-->C
public class ChooseA {
    public static void main(String[] args) {
        Thread threadA = new Thread(() -> {
            System.out.println(Thread.currentThread().getName());
        }, "DemoA");
        Thread threadB = new Thread(() -> {
            System.out.println(Thread.currentThread().getName());
            try {
                threadA.join();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }, "B");
        Thread threadC = new Thread(() -> {
            System.out.println(Thread.currentThread().getName());
            try {
                threadB.join();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }, "C");

        threadB.setPriority(Thread.MAX_PRIORITY);
        threadA.start();
        threadB.start();
        threadC.start();
    }


}
